import { Text, View } from '@tarojs/components';
import React from 'react';
import Medicine from '@COMPONENTS/Medicine'
import i18n from '@I18N'
import './AdviceHeader.scss'

const Item = ({ title, des }) => (
  <View className='advice-item-root'>
    <Text className="advice-title">{title}</Text>
    <Text className="advice-content-text">{des}</Text>
  </View>
)
const AdviceHeader = ({
  doctorAdvice, diagnosis, medicineArray, language, showItems, lastItemStyle, isShowBottom
}) => (
  <View className="advice-header">
    <Item title={i18n.message.doctor_advice()} des={doctorAdvice || i18n.common.none()} />
    <Item title={i18n.message.disease()} des={diagnosis || i18n.common.none()} />
    <Text className="advice-title">{i18n.message.medication_advices()}</Text>
    <Medicine
      medicines={medicineArray}
      language={language}
      showItems={showItems}
      isShowBottom={isShowBottom}
      lastItemStyle={lastItemStyle}
      showNoText
    />
  </View>
)
export default AdviceHeader
